home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / basic / PureBasic_Upd.lha / PureBasic_Update1.60 / PureBasic / PureInclude / dos / dosextens.pb
Encoding:
Text File  |  2000-09-10  |  14.4 KB  |  485 lines

  1. ;
  2. ; ** $VER: dosextens.h 36.41 (14.5.92)
  3. ; ** Includes Release 40.15
  4. ; **
  5. ; ** DOS structures not needed for the casual AmigaDOS user
  6. ; **
  7. ; ** (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  8. ; **     All Rights Reserved
  9. ;
  10. ;
  11. ; 27/03/1999
  12. ;   Fixed union stuff
  13.  
  14. IncludePath   "PureInclude:"
  15. XIncludeFile "exec/tasks.pb"
  16. XIncludeFile "exec/ports.pb"
  17. XIncludeFile "exec/libraries.pb"
  18. XIncludeFile "exec/semaphores.pb"
  19. XIncludeFile "devices/timer.pb"
  20.  
  21. ;XIncludeFile "dos/dos.pb"
  22.  
  23. ;  All DOS processes have this structure
  24. ;  Create and Device Proc returns pointer to the MsgPort in this structure
  25. ;  dev_proc = (struct Process *) (DeviceProc(..) - sizeof(struct Task));
  26.  
  27. Structure Process
  28.     pr_Task.Task
  29.     pr_MsgPort.MsgPort ;  This is BPTR address from DOS functions
  30.     pr_Pad.w  ;  Remaining variables on 4 byte boundaries
  31.     pr_SegList.l  ;  Array of seg lists used by this process
  32.     pr_StackSize.l ;  Size of process stack in bytes
  33.     *pr_GlobVec.l  ;  Global vector for this process (BCPL)
  34.     pr_TaskNum.l  ;  CLI task number of zero if not a CLI
  35.     pr_StackBase.l ;  Ptr to high memory end of process stack
  36.     pr_Result2.l  ;  Value of secondary result from last call
  37.     pr_CurrentDir.l ;  Lock associated with current directory
  38.     pr_CIS.l  ;  Current CLI Input Stream
  39.     pr_COS.l  ;  Current CLI Output Stream
  40.     *pr_ConsoleTask.l ;  Console handler process for current window
  41.     *pr_FileSystemTask.l ;  File handler process for current drive
  42.     pr_CLI.l  ;  pointer to CommandLineInterface
  43.     *pr_ReturnAddr.l ;  pointer to previous stack frame
  44.     *pr_PktWait.l  ;  Function to be called when awaiting msg
  45.     *pr_WindowPtr.l ;  Window for error printing
  46.  
  47.     ;  following definitions are new with 2.0
  48.     pr_HomeDir.l  ;  Home directory of executing program
  49.     pr_Flags.l  ;  flags telling dos about process
  50.     *pr_ExitCode.l ;  code to call on exit of program or NULL
  51.     pr_ExitData.l ;  Passed as an argument to pr_ExitCode.
  52.     *pr_Arguments.b ;  Arguments passed to the process at start
  53.     pr_LocalVars.MinList ;  Local environment variables
  54.     pr_ShellPrivate.l ;  for the use of the current shell
  55.     pr_CES.l  ;  Error stream - if NULL, use pr_COS
  56. EndStructure  ;  Process
  57.  
  58. ;
  59. ;  * Flags for pr_Flags
  60. ;
  61. #PRB_FREESEGLIST  = 0
  62. #PRF_FREESEGLIST  = 1
  63. #PRB_FREECURRDIR  = 1
  64. #PRF_FREECURRDIR  = 2
  65. #PRB_FREECLI  = 2
  66. #PRF_FREECLI  = 4
  67. #PRB_CLOSEINPUT  = 3
  68. #PRF_CLOSEINPUT  = 8
  69. #PRB_CLOSEOUTPUT  = 4
  70. #PRF_CLOSEOUTPUT  = 16
  71. #PRB_FREEARGS  = 5
  72. #PRF_FREEARGS  = 32
  73.  
  74. ;  The long word address (BPTR) of this structure is returned by
  75. ;  * Open() and other routines that return a file.  You need only worry
  76. ;  * about this struct to do async io's via PutMsg() instead of
  77. ;  * standard file system calls
  78.  
  79. Structure FileHandle
  80.    *fh_Link.Message  ;  EXEC message
  81.    *fh_Port.MsgPort  ;  Reply port for the packet
  82.    *fh_Type.MsgPort  ;  Port to do PutMsg() to
  83. ;       * Address is negative if a plain file
  84.    fh_Buf.l
  85.    fh_Pos.l
  86.    fh_End.l
  87.    fh_Funcs.l
  88. ;#fh_Func1 = fh_Funcs
  89.    fh_Func2.l
  90.    fh_Func3.l
  91.    fh_Args.l
  92. ;#fh_Arg1 = fh_Args
  93.    fh_Arg2.l
  94. EndStructure ;  FileHandle
  95.  
  96. ;  This is the extension to EXEC Messages used by DOS
  97.  
  98. Structure DosPacket
  99.    *dp_Link.Message  ;  EXEC message
  100.    *dp_Port.MsgPort  ;  Reply port for the packet
  101.      ;  Must be filled in each send.
  102.    dp_Type.l   ;  See ACTION_... below and
  103. ;       * 'R' means Read, 'W' means Write to the
  104. ;       * file system
  105.    dp_Res1.l   ;  For file system calls this is the result
  106. ;       * that would have been returned by the
  107. ;       * function, e.g. Write ('W') returns actual
  108. ;       * length written
  109.    dp_Res2.l   ;  For file system calls this is what would
  110. ;       * have been returned by IoErr()
  111. ;   Device packets common equivalents
  112. ;#dp_Action  = dp_Type
  113. ;#dp_Status  = dp_Res1
  114. ;#dp_Status2 = dp_Res2
  115. ;#dp_BufAddr = dp_Arg1
  116.    dp_Arg1.l
  117.    dp_Arg2.l
  118.    dp_Arg3.l
  119.    dp_Arg4.l
  120.    dp_Arg5.l
  121.    dp_Arg6.l
  122.    dp_Arg7.l
  123. EndStructure ;  DosPacket
  124.  
  125. ;  A Packet does not require the Message to be before it in memory, but
  126. ;  * for convenience it is useful to associate the two.
  127. ;  * Also see the function init_std_pkt for initializing this structure
  128.  
  129. Structure StandardPacket
  130.    sp_Msg.Message
  131.    sp_Pkt.DosPacket
  132. EndStructure ;  StandardPacket
  133.  
  134. ;  Packet types
  135. #ACTION_NIL  = 0
  136. #ACTION_STARTUP  = 0
  137. #ACTION_GET_BLOCK = 2 ;  OBSOLETE
  138. #ACTION_SET_MAP  = 4
  139. #ACTION_DIE  = 5
  140. #ACTION_EVENT  = 6
  141. #ACTION_CURRENT_VOLUME = 7
  142. #ACTION_LOCATE_OBJECT = 8
  143. #ACTION_RENAME_DISK = 9
  144. #ACTION_WRITE  = 87 ; 'W'
  145. #ACTION_READ  =  82 ; 'R'
  146. #ACTION_FREE_LOCK = 15
  147. #ACTION_DELETE_OBJECT = 16
  148. #ACTION_RENAME_OBJECT = 17
  149. #ACTION_MORE_CACHE = 18
  150. #ACTION_COPY_DIR  = 19
  151. #ACTION_WAIT_CHAR = 20
  152. #ACTION_SET_PROTECT = 21
  153. #ACTION_CREATE_DIR = 22
  154. #ACTION_EXAMINE_OBJECT = 23
  155. #ACTION_EXAMINE_NEXT = 24
  156. #ACTION_DISK_INFO = 25
  157. #ACTION_INFO  = 26
  158. #ACTION_FLUSH  = 27
  159. #ACTION_SET_COMMENT = 28
  160. #ACTION_PARENT  = 29
  161. #ACTION_TIMER  = 30
  162. #ACTION_INHIBIT  = 31
  163. #ACTION_DISK_TYPE = 32
  164. #ACTION_DISK_CHANGE = 33
  165. #ACTION_SET_DATE  = 34
  166.  
  167. #ACTION_SCREEN_MODE = 994
  168.  
  169. #ACTION_READ_RETURN = 1001
  170. #ACTION_WRITE_RETURN = 1002
  171. #ACTION_SEEK  = 1008
  172. #ACTION_FINDUPDATE = 1004
  173. #ACTION_FINDINPUT = 1005
  174. #ACTION_FINDOUTPUT = 1006
  175. #ACTION_END  = 1007
  176. #ACTION_SET_FILE_SIZE = 1022 ;  fast file system only in 1.3
  177. #ACTION_WRITE_PROTECT = 1023 ;  fast file system only in 1.3
  178.  
  179. ;  new 2.0 packets
  180. #ACTION_SAME_LOCK = 40
  181. #ACTION_CHANGE_SIGNAL = 995
  182. #ACTION_FORMAT  = 1020
  183. #ACTION_MAKE_LINK = 1021
  184. ;
  185. ;
  186. #ACTION_READ_LINK = 1024
  187. #ACTION_FH_FROM_LOCK = 1026
  188. #ACTION_IS_FILESYSTEM = 1027
  189. #ACTION_CHANGE_MODE = 1028
  190. ;
  191. #ACTION_COPY_DIR_FH = 1030
  192. #ACTION_PARENT_FH = 1031
  193. #ACTION_EXAMINE_ALL = 1033
  194. #ACTION_EXAMINE_FH = 1034
  195.  
  196. #ACTION_LOCK_RECORD = 2008
  197. #ACTION_FREE_RECORD = 2009
  198.  
  199. #ACTION_ADD_NOTIFY = 4097
  200. #ACTION_REMOVE_NOTIFY = 4098
  201.  
  202. ;  Added in V39:
  203. #ACTION_EXAMINE_ALL_END = 1035
  204. #ACTION_SET_OWNER = 1036
  205.  
  206. ;  Tell a file system to serialize the current volume. This is typically
  207. ;  * done by changing the creation date of the disk. This packet does not take
  208. ;  * any arguments.  NOTE: be prepared to handle failure of this packet for
  209. ;  * V37 ROM filesystems.
  210. ;
  211. #ACTION_SERIALIZE_DISK = 4200
  212.  
  213. ;
  214. ;  * A structure for holding error messages - stored as array with error == 0
  215. ;  * for the last entry.
  216. ;
  217. Structure ErrorString
  218.  *estr_Nums.l
  219.  *estr_Strings.b
  220. EndStructure
  221.  
  222. ;  DOS library node structure.
  223. ;  * This is the data at positive offsets from the library node.
  224. ;  * Negative offsets from the node is the jump table to DOS functions
  225. ;  * node = (struct DosLibrary *) OpenLibrary( "dos.library" .. )
  226.  
  227. Structure DosLibrary
  228.     dl_lib.Library
  229.     *dl_Root.RootNode ;  Pointer to RootNode, described below
  230.     *dl_GV.l       ;  Pointer to BCPL global vector
  231.     dl_A2.l       ;  BCPL standard register values
  232.     dl_A5.l
  233.     dl_A6.l
  234.     *dl_Errors.ErrorString   ;  PRIVATE pointer to array of error msgs
  235.     *dl_TimeReq.timerequest   ;  PRIVATE pointer to timer request
  236.     *dl_UtilityBase.l   ;  PRIVATE ptr to utility library
  237.     *dl_IntuitionBase.l ;  PRIVATE ptr to intuition library
  238. EndStructure  ;  DosLibrary
  239.  
  240. ;
  241.  
  242. Structure RootNode
  243.     rn_TaskArray.l      ;  [0] is max number of CLI's
  244. ;           * [1] is APTR to process id of CLI 1
  245. ;           * [n] is APTR to process id of CLI n
  246.     rn_ConsoleSegment.l ;  SegList for the CLI
  247.     rn_Time.DateStamp ;  Current time
  248.     rn_RestartSeg.l     ;  SegList for the disk validator process
  249.     rn_Info.l        ;  Pointer to the Info structure
  250.     rn_FileHandlerSegment.l ;  segment for a file handler
  251.     rn_CliList.MinList ;  new list of all CLI processes
  252.           ;  the first cpl_Array is also rn_TaskArray
  253.     *rn_BootProc.MsgPort ;  private ptr to msgport of boot fs
  254.     rn_ShellSegment.l   ;  seglist for Shell (for NewShell)
  255.     rn_Flags.l        ;  dos flags
  256. EndStructure  ;  RootNode
  257.  
  258. #RNB_WILDSTAR = 24
  259. #RNF_WILDSTAR = (1 LSL 24)
  260. #RNB_PRIVATE1 = 1 ;  private for dos
  261. #RNF_PRIVATE1 = 2
  262.  
  263. ;  ONLY to be allocated by DOS!
  264. Structure CliProcList
  265.  cpl_Node.MinNode
  266.  cpl_First.l      ;  number of first entry in array
  267.  *cpl_Array.MsgPort
  268.         ;  [0] is max number of CLI's in this entry (n)
  269. ;          * [1] is CPTR to process id of CLI cpl_First
  270. ;          * [n] is CPTR to process id of CLI cpl_First+n-1
  271. ;
  272. EndStructure
  273.  
  274. Structure DosInfo
  275.     di_McName.l        ;  PRIVATE: system resident module list
  276. ;#di_ResList = di_McName
  277.     di_DevInfo.l        ;  Device List
  278.     di_Devices.l        ;  Currently zero
  279.     di_Handlers.l       ;  Currently zero
  280.     *di_NetHand.l        ;  Network handler processid; currently zero
  281.     di_DevLock.SignalSemaphore    ;  do NOT access directly!
  282.     di_EntryLock.SignalSemaphore  ;  do NOT access directly!
  283.     di_DeleteLock.SignalSemaphore ;  do NOT access directly!
  284. EndStructure  ;  DosInfo
  285.  
  286. ;  structure for the Dos resident list.  Do NOT allocate these, use
  287. ;  AddSegment(), and heed the warnings in the autodocs!
  288.  
  289. Structure Segment
  290.  seg_Next.l
  291.  seg_UC.l
  292.  seg_Seg.l
  293.  seg_Name.b[4] ;  actually the first 4 chars of BSTR name
  294. EndStructure
  295.  
  296. #CMD_SYSTEM = -1
  297. #CMD_INTERNAL = -2
  298. #CMD_DISABLED = -999
  299.  
  300.  
  301. ;  DOS Processes started from the CLI via RUN or NEWCLI have this additional
  302. ;  * set to data associated with them
  303.  
  304. Structure CommandLineInterface
  305.     cli_Result2.l        ;  Value of IoErr from last command
  306.     cli_SetName.l        ;  Name of current directory
  307.     cli_CommandDir.l     ;  Head of the path locklist
  308.     cli_ReturnCode.l     ;  Return code from last command
  309.     cli_CommandName.l    ;  Name of current command
  310.     cli_FailLevel.l      ;  Fail level (set by FAILAT)
  311.     cli_Prompt.l        ;  Current prompt (set by PROMPT)
  312.     cli_StandardInput.l  ;  Default (terminal) CLI input
  313.     cli_CurrentInput.l   ;  Current CLI input
  314.     cli_CommandFile.l    ;  Name of EXECUTE command file
  315.     cli_Interactive.l    ;  Boolean; True if prompts required
  316.     cli_Background.l     ;  Boolean; True if CLI created by RUN
  317.     cli_CurrentOutput.l  ;  Current CLI output
  318.     cli_DefaultStack.l   ;  Stack size to be obtained in long words
  319.     cli_StandardOutput.l ;  Default (terminal) CLI output
  320.     cli_Module.l        ;  SegList of currently loaded command
  321. EndStructure  ;  CommandLineInterface
  322.  
  323. ;  This structure can take on different values depending on whether it is
  324. ;  * a device, an assigned directory, or a volume.  Below is the structure
  325. ;  * reflecting volumes only.  Following that is the structure representing
  326. ;  * only devices. Following that is the unioned structure representing all
  327. ;  * the values
  328. ;
  329.  
  330. ;  structure representing a volume
  331.  
  332. Structure DeviceList
  333.     dl_Next.l ;  bptr to next device list
  334.     dl_Type.l ;  see DLT below
  335.     *dl_Task.MsgPort ;  ptr to handler task
  336.     dl_Lock.l ;  not for volumes
  337.     dl_VolumeDate.DateStamp ;  creation date
  338.     dl_LockList.l ;  outstanding locks
  339.     dl_DiskType.l ;  'DOS', etc
  340.     dl_unused.l
  341.     dl_Name.l ;  bptr to bcpl name
  342. EndStructure
  343.  
  344. ;  device structure (same as the DeviceNode structure in filehandler.h)
  345.  
  346. Structure       DevInfo
  347.     dvi_Next.l
  348.     dvi_Type.l
  349.     *dvi_Task.l
  350.     dvi_Lock.l
  351.     dvi_Handler.l
  352.     dvi_StackSize.l
  353.     dvi_Priority.l
  354.     dvi_Startup.l
  355.     dvi_SegList.l
  356.     dvi_GlobVec.l
  357.     dvi_Name.l
  358. EndStructure
  359.  
  360. ;  combined structure for devices, assigned directories, volumes
  361.  
  362. Structure DosList
  363.   dol_Next.l       ;  bptr to next device on list
  364.   dol_Type.l       ;  see DLT below
  365.  *dol_Task.MsgPort ;  ptr to handler task
  366.   dol_Lock.l
  367.  
  368.   StructureUnion
  369.     dol_Handler.l       ;  file name to load if seglist is null
  370.     dol_VolumeDate.DateStamp
  371.    *dol_AssignName.b    ;  name for non-or-late-binding assign
  372.   EndStructureUnion
  373.  
  374.   StructureUnion
  375.     dol_StackSize.l     ;  stacksize to use when starting process
  376.    *dol_List.AssignList ;  for multi-directory assigns (regular)
  377.   EndStructureUnion
  378.  
  379.   StructureUnion
  380.     dol_Priority.l      ;  task priority when starting process
  381.     dol_LockList.l      ;  outstanding locks
  382.   EndStructureUnion
  383.  
  384.   StructureUnion
  385.     dol_Startup.l       ;  startup msg: FileSysStartupMsg for disks
  386.     dol_DiskType.l      ;  'DOS', etc
  387.   EndStructureUnion
  388.  
  389.   dol_SegList.l  ;  already loaded code for new task
  390.   dol_GlobVec.l  ;  BCPL global vector to use when starting
  391.  
  392.  *dol_Name.b  ;  bptr to bcpl name
  393.  
  394. EndStructure
  395.  
  396. ;  structure used for multi-directory assigns. AllocVec()ed.
  397.  
  398. Structure AssignList
  399.  *al_Next.AssignList
  400.  al_Lock.l
  401. EndStructure
  402.  
  403. ;  definitions for dl_Type
  404. #DLT_DEVICE = 0
  405. #DLT_DIRECTORY = 1 ;  assign
  406. #DLT_VOLUME = 2
  407. #DLT_LATE = 3 ;  late-binding assign
  408. #DLT_NONBINDING = 4 ;  non-binding assign
  409. #DLT_PRIVATE = -1 ;  for internal use only
  410.  
  411. ;  structure return by GetDeviceProc()
  412. Structure DevProc
  413.  *dvp_Port.MsgPort
  414.  dvp_Lock.l
  415.  dvp_Flags.l
  416.  *dvp_DevNode.DosList ;  DON'T TOUCH OR USE!
  417. EndStructure
  418.  
  419. ;  definitions for dvp_Flags
  420. #DVPB_UNLOCK = 0
  421. #DVPF_UNLOCK = (1  LSL  #DVPB_UNLOCK)
  422. #DVPB_ASSIGN = 1
  423. #DVPF_ASSIGN = (1  LSL  #DVPB_ASSIGN)
  424.  
  425. ;  Flags to be passed to LockDosList(), etc
  426. #LDB_DEVICES = 2
  427. #LDF_DEVICES = (1  LSL  #LDB_DEVICES)
  428. #LDB_VOLUMES = 3
  429. #LDF_VOLUMES = (1  LSL  #LDB_VOLUMES)
  430. #LDB_ASSIGNS = 4
  431. #LDF_ASSIGNS = (1  LSL  #LDB_ASSIGNS)
  432. #LDB_ENTRY = 5
  433. #LDF_ENTRY = (1  LSL  #LDB_ENTRY)
  434. #LDB_DELETE = 6
  435. #LDF_DELETE = (1  LSL  #LDB_DELETE)
  436.  
  437. ;  you MUST specify one of LDF_READ or LDF_WRITE
  438. #LDB_READ = 0
  439. #LDF_READ = (1  LSL  #LDB_READ)
  440. #LDB_WRITE = 1
  441. #LDF_WRITE = (1  LSL  #LDB_WRITE)
  442.  
  443. ;  actually all but LDF_ENTRY (which is used for internal locking)
  444. #LDF_ALL  = (#LDF_DEVICES|#LDF_VOLUMES|#LDF_ASSIGNS)
  445.  
  446. ;  a lock structure, as returned by Lock() or DupLock()
  447. Structure FileLock
  448.   fl_Link.l       ;  bcpl pointer to next lock
  449.   fl_Key.l        ;  disk block number
  450.   fl_Access.l     ;  exclusive or shared
  451.  *fl_Task.MsgPort ;  handler task's port
  452.   fl_Volume.l     ;  bptr to DLT_VOLUME DosList entry
  453. EndStructure
  454.  
  455. ;  error report types for ErrorReport()
  456. #REPORT_STREAM  = 0 ;  a stream
  457. #REPORT_TASK  = 1 ;  a process - unused
  458. #REPORT_LOCK  = 2 ;  a lock
  459. #REPORT_VOLUME  = 3 ;  a volume node
  460. #REPORT_INSERT  = 4 ;  please insert volume
  461.  
  462. ;  Special error codes for ErrorReport()
  463. #ABORT_DISK_ERROR = 296 ;  Read/write error
  464. #ABORT_BUSY  = 288 ;  You MUST replace...
  465.  
  466. ;  types for initial packets to shells from run/newcli/execute/system.
  467. ;  For shell-writers only
  468. #RUN_EXECUTE  = -1
  469. #RUN_SYSTEM  = -2
  470. #RUN_SYSTEM_ASYNCH = -3
  471.  
  472. ;  Types for fib_DirEntryType. NOTE that both USERDIR and ROOT are
  473. ;  directories, and that directory/file checks should use <0 and >=0.
  474. ;  This is not necessarily exhaustive! Some handlers may use other
  475. ;  values as needed, though <0 and >=0 should remain as supported as
  476. ;  possible.
  477. #ST_ROOT  = 1
  478. #ST_USERDIR = 2
  479. #ST_SOFTLINK = 3 ;  looks like dir, but may point to a file!
  480. #ST_LINKDIR = 4 ;  hard link to dir
  481. #ST_FILE  = -3 ;  must be negative for FIB!
  482. #ST_LINKFILE = -4 ;  hard link to file
  483. #ST_PIPEFILE = -5 ;  for pipes that support ExamineFH
  484.  
  485.